<template>
  <div class="multiVModelWrap">
    <h2>Slot的常用方式</h2>
    <subComponent>
      <template v-slot:[header]="slotProps">
        <h3>这里是传入的header插槽内容</h3>
        <div>动态插槽名只能使用v-slot:[插槽名称变量]</div>
        <div>父组件中的数据，直接使用position-{{ position }}</div>
        <div>子组件中的数据，绑定在插槽slot标签的props上使用-{{ slotProps.subPosition }}</div>
      </template>
      <template #foot>
        <h3>这里是传入的foot插槽内容</h3>
      </template>
    </subComponent>
  </div>
</template>

<script lang="ts">
import subComponent from "./components/subComponent.vue";
import { defineComponent } from "vue";
export default defineComponent({
  components: {
    subComponent,
  },
  props: {
    user: {
      type: String,
      required: true,
    },
  },
  emits: [],
  data() {
    return {
      header: "header",
      position: "珠海",
      month: "5",
    };
  },
  methods: {},
});
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
